package cn.echisan.homework.model;

import cn.echisan.homework.validator.LoginCheck;
import cn.echisan.homework.validator.RegisterCheck;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;


public class User {
    private Integer id;

    @NotEmpty(message = "学号/教师号不能为空", groups = {RegisterCheck.class, LoginCheck.class})
    @Pattern(regexp = "^[0-9]*$", message = "学号/教师号必须为数字", groups = {RegisterCheck.class, LoginCheck.class})
    private String identifyNum;

    @NotEmpty(message = "姓名不能为空", groups = RegisterCheck.class)
    @Size(message = "名字长度不正确", min = 2,max = 4, groups = RegisterCheck.class)
    private String name;

    @NotEmpty(message = "性别不能为空", groups = RegisterCheck.class)
    private String sex;

    private String role;

    private Integer age;

    @NotEmpty(message = "密码不能为空", groups = {RegisterCheck.class, LoginCheck.class})
    private String password;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getIdentifyNum() {
        return identifyNum;
    }

    public void setIdentifyNum(String identifyNum) {
        this.identifyNum = identifyNum == null ? null : identifyNum.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex == null ? null : sex.trim();
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role == null ? null : role.trim();
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }
}